import pytest

from Auto.day02.card.Card_Data import Card_Data
from Auto.day02.card.Card_Operation import Card_Operation
from utils.ReadYaml import ReadYaml
from utils.XLUtils import XLUtils

class Test_Card(Card_Operation):
    @pytest.mark.parametrize("username,password,bank,kind,card_number,expect",Card_Data.New_Card_Data)
    def test_newCard(self,username,password,bank,kind,card_number,expect,login_driver,new_card):
        result = self.getSuccessMsg(login_driver)
        self.assserttitle(login_driver,result,expect)

    @pytest.mark.parametrize("username,password,card_number,expect", Card_Data.Del_Card_Data)
    def test_deleteCard(self,username,password,card_number,expect,del_card,login_driver):
        result = self.getSuccessMsg(login_driver)
        self.assserttitle(login_driver,result,expect)

    @pytest.mark.parametrize("username,password,card_ID,bank,kind,card_number,expect", Card_Data.Mod_Card_Data)
    def test_updateCard(self,username,password,card_ID,bank,kind,card_number,expect,login_driver,update_card):
        result = self.getSuccessMsg(login_driver)
        self.assserttitle(login_driver, result, expect)

    @pytest.mark.parametrize("username,password,bank,kind,card_number,expect",
                             ReadYaml.read_yaml("D:\Python\Project\project01\Auto\day02\data.yaml")['New_Card_Data'])
    def test_newCard1(self, username, password, bank, kind, card_number, expect, login_driver, new_card):
        result = self.getSuccessMsg(login_driver)
        self.assserttitle(login_driver, result, expect)

    @pytest.mark.parametrize("username,password,card_number,expect",
                             ReadYaml.read_yaml("D:\Python\Project\project01\Auto\day02\data.yaml")['Del_Card_Data'])
    def test_deleteCard1(self, username, password, card_number, expect, del_card, login_driver):
        result = self.getSuccessMsg(login_driver)
        self.assserttitle(login_driver, result, expect)

    @pytest.mark.parametrize("username,password,card_ID,bank,kind,card_number,expect",
                             ReadYaml.read_yaml("D:\Python\Project\project01\Auto\day02\data.yaml")['Mod_Card_Data'])
    def test_updateCard1(self, username, password, card_ID, bank, kind, card_number, expect, login_driver, update_card):
        result = self.getSuccessMsg(login_driver)
        self.assserttitle(login_driver, result, expect)

    @pytest.mark.parametrize("username,password,bank,kind,card_number,expect",
                            XLUtils.read_excel("D:\Python\Project\project01\Auto\day02\data.xlsx","New_Card_Data"))
    def test_newCard2(self, username, password, bank, kind, card_number, expect, login_driver, new_card):
        result = self.getSuccessMsg(login_driver)
        self.assserttitle(login_driver, result, expect)

    @pytest.mark.parametrize("username,password,card_number,expect",
                             XLUtils.read_excel("D:\Python\Project\project01\Auto\day02\data.xlsx","Del_Card_Data"))
    def test_deleteCard2(self, username, password, card_number, expect, del_card, login_driver):
        result = self.getSuccessMsg(login_driver)
        self.assserttitle(login_driver, result, expect)

    @pytest.mark.parametrize("username,password,card_ID,bank,kind,card_number,expect",
                             XLUtils.read_excel("D:\Python\Project\project01\Auto\day02\data.xlsx","Mod_Card_Data"))
    def test_updateCard2(self, username, password, card_ID, bank, kind, card_number, expect, login_driver, update_card):
        result = self.getSuccessMsg(login_driver)
        self.assserttitle(login_driver, result, expect)